var app = getApp();

Page({
    data: {
        mails: [],
        is_show: !1,
        glo_is_load: !0,
        btn_disabled: !1,
        submitIsLoading: !1
    },
    onLoad: function(a) {
        var t = this, e = a.cid;
        t.setData({
            this_mails_id: e
        }), app.util.request({
            url: "entry/wxapp/GetCard",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                0 == a.data.errno && 0 == a.data.data && wx.showModal({
                    title: "你还没有创建名片，不能创建分会",
                    content: "你还没有创建名片，不能创建分会",
                    showCancel: !1,
                    success: function() {
                        wx.switchTab({
                            url: "/pages/card/edit/card-edit"
                        });
                    }
                }), t.setData({
                    admin_info: a.data.data,
                    admin_id: a.data.data.id,
                    admin_openid: a.data.data.openid
                });
            }
        });
    },
    onShow: function() {
        var t = this;
        t.setData({
            mails: null
        }), app.util.request({
            url: "entry/wxapp/GetMailsAd",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                0 == a.data.errno && t.setData({
                    mails: a.data.data,
                    mail_key: a.data.data.mail_key,
                    is_show: !1
                });
            }
        }), app.util.request({
            url: "entry/wxapp/GetMailsb",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                0 == a.data.errno && t.setData({
                    m_number: a.data.data,
                    m_numbers: a.data.data.count,
                    is_show: !1
                });
            }
        });
    },
    adopt_mail: function(a) {
        var t = this;
        t.setData({
            btn_disabled: !0,
            submitIsLoading: !0
        }), app.util.request({
            url: "entry/wxapp/PostMyMailAdopt",
            data: {
                m: "bbyscm_card",
                id: a.currentTarget.id,
                mail_key: 1
            }
        }), app.util.request({
            url: "entry/wxapp/GetMailsAd",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                0 == a.data.errno && t.setData({
                    mails: a.data.data,
                    mail_key: a.data.data.mail_key,
                    is_show: !1
                });
            }
        });
    },
    close_mails: function(a) {
        var t = this;
        t.setData({
            btn_disabled: !1,
            submitIsLoading: !1
        }), app.util.request({
            url: "entry/wxapp/PostMyMailAdopt",
            data: {
                m: "bbyscm_card",
                id: a.currentTarget.id,
                mail_key: 0
            }
        }), app.util.request({
            url: "entry/wxapp/GetMailsAd",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                0 == a.data.errno && t.setData({
                    mails: a.data.data,
                    mail_key: a.data.data.mail_key,
                    is_show: !1
                });
            }
        });
    },
    call_phone_bind: function(a) {
        var t = a.currentTarget.id;
        "" != t && wx.makePhoneCall({
            phoneNumber: t
        });
    },
    onPullDownRefresh: function() {
        setTimeout(function() {
            wx.stopPullDownRefresh();
        }, 1e3);
    },
    look_card_info_bind: function(a) {
        wx.navigateTo({
            url: "../mail/mail?mid=" + a.currentTarget.id
        });
    }
});